#include "logo.h"

char *first(void)
{
     int i;
     int k;
     char *ans;
     char *val;
     char valStr[MAXVALUE] ="\0";
     char ansStr[MAXVALUE] ="\0";

     val =valStr;
     ans =ansStr;
     strcpy(val,getValue());
     printf("string of first is %s\n",val);
     if (val[0] == '[')
     {
        i=1;
        k=0;
        while (i<strlen(val)-1)
        {
              if ((!k)&&(i>1)&&((val[i] ==' ')||(val[i] =='[')))
              {
                 break;
              }else if (val[i] =='[')
              {
                    k++;
              }else if (val[i] ==']')
              {
                    k--;
              }
              printf("char of first is %c,%d\n",val[i],k);
              if ((val[i] =='\"')&&(strlen(ans) ==0))
              {
                 i++;
                 continue;
              }
              ans[strlen(ans)+1]='\0';
              ans[strlen(ans)] =val[i];
              i++;
        }
        goto RE;
     }
     ans[1] ='\0';
     ans[0] =val[0];
     RE:
            return ans;
}
